//
//  ProgressView.swift
//  edaixi_client_ios
//
//  Created by 刘树华 on 2017/11/13.
//  Copyright © 2017年 刘树华. All rights reserved.
//

import Foundation
import UIKit



class ProgressView : CAShapeLayer {
    
   
    
    init(backColor:UIColor,fillColor:UIColor) {
        super.init()
        self.backgroundColor = backColor.cgColor
        self.strokeColor = fillColor.cgColor
        self.lineWidth = 2
       let mutablePath = CGMutablePath()
        mutablePath.move(to: CGPoint(x: 0, y: 1))
        mutablePath.addLine(to: CGPoint(x: SCREEN_WIDTH, y: 1))
        self.path = mutablePath
        self.strokeEnd = 0
    }
   
    func setPro (pro:CGFloat)  {
        self.strokeEnd = pro
        if pro > 0.99 {
            self.removeFromSuperlayer()
        }
    }
    

    override init(layer: Any) {
        super.init(layer: layer)
    }
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
}
